package com.qk.management.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RoleMapper {
    List<Role> selectByPage(
            @Param("name") String name,
            @Param("label") String status,
            @Param("remark") String remark,
            @Param("offset") Integer offset,
            @Param("pageSize") Integer pageSize);

    List<Role> list(
            @Param("name") String name,
            @Param("label") String status,
            @Param("remark") String remark
    );

    @Delete("delete from role where id = #{id}")
    void deleteById(Integer id);

    @Insert("insert into role(name,label,remark,creat_time,update_time) values(#{name},#{label},#{remark},now(),now())")
    void add(Role role);

    @Select("select * from role where id = #{id}")
    Role getById(Integer id);

    void update(Role role);

    @Select("select * from role")
    List<Role> findAll();

    @Select("select * from role where id = #{roleId}")
    Role selectByRoleId(Integer roleId);
}
